package top.bug.blog.entity.dto.sys;

import lombok.Data;

import java.util.List;

/**
 * @author <a href="https://github.com/jiusi66">九思.</a>
 * @email 10837907@qq.com
 * @from <a href="https://www.52bug.top">递归茶馆-www.52bug.top</a>
 * @description 统一监控数据 DTO，分组展示服务信息
 */
@Data
public class ServerInfoDTO {

    private SystemInfo system;
    private CpuInfo cpu;
    private MemoryInfo memory;
    private JvmInfo jvm;
    private List<DiskInfo> disks;
    private DbInfo db;

    @Data
    public static class SystemInfo {
        private String osName;
        private String osArch;
        private String osVersion;
        private String hostName;
    }

    @Data
    public static class CpuInfo {
        private int cores;
        private double systemUsage;
        private double userUsage;
        private double idle;
    }

    @Data
    public static class MemoryInfo {
        private long total;
        private long used;
        private long free;
    }

    @Data
    public static class JvmInfo {
        private long maxMemory;
        private long totalMemory;
        private long freeMemory;
        private long usedMemory;
        private long uptime;
        private long threadCount;
        private long peakThreadCount;
        private long loadedClassCount;
        private long gcCount;
        private long gcTime;
    }

    @Data
    public static class DiskInfo {
        private String mount;
        private String type;
        private long total;
        private long free;
        private long used;
    }

    @Data
    public static class DbInfo {
        private String driverName;
        private String driverVersion;
        private int activeConnections;
        private int maxConnections;
        private int minConnections;
    }
}
